import { createStore } from "vuex";

export default createStore({
  state: {
    user: JSON.parse(window.localStorage.getItem("user")),
  },
  mutations: {
    setUser(state, payload) {
      window.localStorage.setItem("user", JSON.stringify(payload));
      state.user = payload;
    },
  },
  actions: {},
  modules: {},
});
